<template>
  <div class="table">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-cascades"></i> 资源管理
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="handle-box">
        <el-button type="primary" icon="el-icon-delete" class="handle-del mr10" @click="batchClose">批量关闭</el-button>
        <el-button
          type="primary"
          icon="el-icon-circle-plus-outline"
          class="ml0 mr10"
          @click="batchOpen"
        >批量开启</el-button>
        
        <el-input v-model="select_pattern" placeholder="筛选关键词" class="handle-input mr10"></el-input>
        <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      </div>
            <el-table
        :data="tableData"
        border
        class="table"
        ref="multipleTable"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column prop="isourcecode" label="代码"></el-table-column>
        <el-table-column prop="idesc" label="描述"></el-table-column>
        
        <el-table-column prop="isourceorg" label="组织"></el-table-column>
        <el-table-column prop="isourcestatus" label="状态"></el-table-column>
        <el-table-column prop="isourcetype" label="类别"></el-table-column>
        <el-table-column label="操作" width="90" align="center">
          <template slot-scope="scope">
            <el-button
              type="text"
              icon="el-icon-edit"
              @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      
      <Pagination :paginationData="paginationData" v-on:childrenData="childrenData"></Pagination>
    </div>

    
  </div>
</template>

<script>
import Pagination from '../base/Pagination.vue'

export default {
  components:{
    Pagination
  },
  name:"source-list",
  data(){
    return{
      paginationData:{
        total: 0,
        pagesize:7,
        pagesizes:[7,],
        currentPage:1,
        layout:"total, sizes, prev, pager, next, jumper"
      },
      curPage:{
        pagesize:7,
        currentPage:1
      },
      tableData:[],
      is_search:false,
      select_pattern:"",
      
    };
  },
  created(){
    this.getData();
  },
  methods:{
    search:function(){
      if (!this.is_search) {
        this.is_search = true;
        this.curPage.currentPage = 1;
        this.getData();
      }
    },
    getData:function(){
      let _self = this;
      if(!this.is_search){
        this.select_pattern="";
      }
      this.$axios
        .get("/api/sys/source/getSourceList", {
          params: {
            pageNum: this.curPage.currentPage,
            pageSize: this.curPage.pagesize,
            select_pattern: this.select_pattern
          }
        })
        .then(function(response) {
          //debugger;
          _self.tableData = response.data.list;
          _self.is_search = false;
          _self.paginationData.total = response.data.total;
        });
    },
    childrenData:function(childrenData){
      this.curPage=childrenData;
    }
  }
}
</script>

<style scoped>
.handle-box {
  margin-bottom: 20px;
}

.handle-select {
  width: 120px;
}

.handle-input {
  width: 300px;
  display: inline-block;
}

.del-dialog-cnt {
  font-size: 16px;
  text-align: center;
}

.table {
  width: 100%;
  font-size: 14px;
}

.red {
  color: #ff0000;
}

.mr10 {
  margin-right: 10px;
}

.ml0 {
  margin-left: 0px;
}
</style>